<template>
    <div>
        <el-page-header @back="goBack" title="返回" content="日志表单"></el-page-header>
        {{form}}
        <el-form ref="form" :model="form" label-width="80px">
            <el-form-item label="姓名">
                <el-input v-model="form.realname"></el-input>
            </el-form-item>
            <el-form-item label="内容">
                <el-input v-model="form.content"></el-input>
            </el-form-item>
            <el-form-item label="方式">
                <el-input v-model="form.method"></el-input>
            </el-form-item>
            <el-form-item label="时间">
                <el-input v-model="form.logTime"></el-input>
            </el-form-item>
        </el-form>
        <div style="text-align:right">
            <el-row>
                <el-button type="primary" plain @click="savaOrUpdate">提交</el-button>
            </el-row>
        </div>
    </div>
</template>

<script>
import {get,post,del} from '@/utils/request'
export default {
    data () {
        return {
            form:{}
        }
    },
    methods: {
        // 添加或更新数据功能
        savaOrUpdate(){
            let url="http://localhost:8888/baselog/saveOrUpdate"
            // 1·调用savaOrUpdate接口并且将数据传送给后台
            post(url,this.form).then(resp=>{
                if(resp.status==20000){
                    this.$message({
                        showClose: true,
                        message: '提交成功',
                        type: 'success'
                    })
                }
            })
            // 2·返回列表界面
            this.$router.push({path:"/baseLog/baseLogList"})

        },
        
        goBack() {
            // 返回上一页
            this.$router.go(-1)
        }
    },
    created () {
        this.form=this.$route.query;
    }
}
</script>

<style lang="sass" scoped>

</style>

